QT       += core gui sql network charts opengl xml multimedia multimediawidgets websockets

CONFIG += force_debug_info
RC_ICONS = logo.ico
win32:{
    QT += webenginewidgets
    QTPLUGIN += qwebengine
    HEADERS += view/webrtc/desktopwebview.h \
    sitckcontrol/onexplayerstickcontrol.h
    SOURCES += view/webrtc/desktopwebview.cpp \
    sitckcontrol/onexplayerstickcontrol.cpp
    CONFIG(release, debug|release):{
    LIBS += -L$$PWD/assimp/win/release/ -lassimp-vc143-mt
    LIBS += -L$$PWD/libssh2/win/debug/ -llibssh2
    QMAKE_POST_LINK +=  $$quote(xcopy $$shell_path($$PWD/data) $$shell_path($$OUT_PWD/release/data/) /y /s)
    }
    else:CONFIG(debug, debug|release): {
    LIBS += -L$$PWD/assimp/win/debug/ -lassimp-vc143-mtd
    LIBS += -L$$PWD/libssh2/win/debug/ -llibssh2
    QMAKE_POST_LINK +=  $$quote(xcopy $$shell_path($$PWD/data) $$shell_path($$OUT_PWD/debug/data/) /y /s)
    }
    LIBS += $$PWD/ffmpeg/win/lib/avcodec.lib \
        $$PWD/ffmpeg/win/lib/avdevice.lib \
        $$PWD/ffmpeg/win/lib/avfilter.lib \
        $$PWD/ffmpeg/win/lib/avformat.lib \
        $$PWD/ffmpeg/win/lib/avutil.lib \
        $$PWD/ffmpeg/win/lib/swresample.lib \
        $$PWD/ffmpeg/win/lib/swscale.lib
    INCLUDEPATH += $$PWD/ffmpeg/win/include/
    DEPENDPATH += $$PWD/ffmpeg/win/include/

    INCLUDEPATH += $$PWD/assimp/win/include/
    DEPENDPATH += $$PWD/assimp/win/include/

    INCLUDEPATH += $$PWD/libssh2/include/
    DEPENDPATH += $$PWD/libssh2/include/
    QMAKE_CFLAGS += /utf-8
    QMAKE_CXXFLAGS += /utf-8
    #编译前获取svn版本号
    SVN_VERSION = $$system($${PWD}\SubWCRev.exe $${PWD} $${PWD}\version.txt $${PWD}\version.h)
}
unix:{
QT += webenginewidgets
QTPLUGIN += qwebengine

HEADERS += view/webrtc/desktopwebview.h
SOURCES += view/webrtc/desktopwebview.cpp

INCLUDEPATH += $$PWD/ffmpeg/linux/include/
DEPENDPATH += $$PWD/ffmpeg/linux/include/

INCLUDEPATH += $$PWD/assimp/linux/include/
DEPENDPATH += $$PWD/assimp/linux/include/

LIBS += -L$$PWD/libssh2/linux/lib/ -lssh2
INCLUDEPATH += $$PWD/libssh2/include/
DEPENDPATH += $$PWD/libssh2/include/
}



greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
include (log4qt/log4qt.pri)

SOURCES += \
    main.cpp \
    models/command.cpp \
    models/curusermodel.cpp \
    models/databasemanager.cpp \
    models/imagemodel.cpp \
    models/mesh.cpp \
    models/meshloader.cpp \
    models/operatelogmodel.cpp \
    models/robot.cpp \
    models/robotlist.cpp \
    models/sshclient.cpp \
    models/sshclient.cpp \
    models/syssettingmodel.cpp \
    models/teachmodel.cpp \
    models/urdfparser.cpp \
    models/videomodel.cpp \
    models/warninglogmodel.cpp \
    public/VideoBase.cpp \
    public/public.cpp \
    sitckcontrol/stickcontrol.cpp \
    view/controlpage/autocontrol/audiocmdwidget.cpp \
    view/controlpage/autocontrol/autoform.cpp \
    view/controlpage/autocontrol/globalcmdwidget.cpp \
    view/controlpage/autocontrol/scalelabel.cpp \
    view/controlpage/autocontrol/selectwnddialog.cpp \
    view/controlpage/autocontrol/slamwidget.cpp \
    view/controlpage/autocontrol/upperlimbwidget.cpp \
    view/controlpage/autocontrol/window.cpp \
    view/controlpage/intelligence/intelligenceform.cpp \
    view/controlpage/maualcontrol/customslider.cpp \
    view/controlpage/maualcontrol/dataWidget.cpp \
    view/controlpage/maualcontrol/jointdatadialog.cpp \
    view/controlpage/maualcontrol/jointsliderwidget.cpp \
    view/controlpage/maualcontrol/maualform.cpp \
    view/controlpage/maualcontrol/robotcontrolwidget.cpp \
    view/controlpage/remote/remoteform.cpp \
    view/controlpage/setting/logmanage/logmanagement.cpp \
    view/controlpage/setting/mediamanage/imagewidget.cpp \
    view/controlpage/setting/mediamanage/mediamanagement.cpp \
    view/controlpage/setting/mediamanage/videoplayerdialog.cpp \
    view/controlpage/setting/mediamanage/videowidget.cpp \
    view/controlpage/setting/settingform.cpp \
    view/controlpage/setting/systemsetting/audiofilewidget.cpp \
    view/controlpage/setting/systemsetting/globalsettingwidget.cpp \
    view/controlpage/setting/systemsetting/hotkeyedit.cpp \
    view/controlpage/setting/systemsetting/otherwidget.cpp \
    view/controlpage/setting/systemsetting/syssettingform.cpp \
    view/controlpage/setting/systemsetting/uppersettingwidget.cpp \
    view/controlpage/setting/usermanage/userdialog.cpp \
    view/controlpage/setting/usermanage/usermanagement.cpp \
    view/controlpage/teach/teachdelegate.cpp \
    view/controlpage/teach/teachdialog.cpp \
    view/controlpage/teach/teachform.cpp \
    view/controlpage/robotcontrolform.cpp \
    view/controlpage/telemetry/telemetrydialog.cpp \
    view/controlpage/zerodialog.cpp \
    view/controltypeform.cpp \
    view/custom/ChartWidget.cpp \
    view/custom/MessageBox.cpp \
    view/custom/batterywidget.cpp \
    view/custom/comboxnowheel.cpp \
    view/custom/custombutton.cpp \
    view/custom/customedit.cpp \
    view/custom/directioncontrolwidget.cpp \
    view/custom/dragbutton.cpp \
    view/custom/switchbutton.cpp \
    view/custom/touchbutton.cpp \
    view/custom/urdfwidget.cpp \
    view/custom/popupdialog.cpp \
    view/custom/rangeslider.cpp \
    view/custom/transparentbutton.cpp \
    view/custom/turncontroller.cpp \
    view/custom/userbutton.cpp \
    view/custom/usermenu.cpp \
    view/custom/warninglabel.cpp \
    view/custom/yschartview.cpp \
    view/custom/yscheckbox.cpp \
    view/custom/yslabel.cpp \
    view/custom/yspushbutton.cpp \
    view/custom/yswidget.cpp \
    view/datamanager/datamanagedialog.cpp \
    view/datamanager/robotdialog.cpp \
    view/loginform.cpp \
    view/mainwindow.cpp \
    view/passworddialog.cpp \
    view/robotlistform.cpp \
    view/rtsp/rtspthread.cpp \
    view/rtsp/rtspwidget.cpp \
    view/rtsp/videodecoderthread.cpp \
    view/sitelistform.cpp \
    view/webrtc/webrtcwidget.cpp \
    view/webrtc/photodialog.cpp \
    view/controlpage/setting/mediamanage/transparentlistview.cpp \
    view/controlpage/setting/mediamanage/imageviewerdialog.cpp \
    #voiceRecognition/voiceanimation.cpp

HEADERS += \
    models/command.h \
    models/curusermodel.h \
    models/databasemanager.h \
    models/imagemodel.h \
    models/mesh.h \
    models/meshloader.h \
    models/operatelogmodel.h \
    models/robot.h \
    models/robotlist.h \
    models/sshclient.h \
    models/sshclient.h \
    models/syssettingmodel.h \
    models/teachmodel.h \
    models/urdfparser.h \
    models/videomodel.h \
    models/warninglogmodel.h \
    public/VideoBase.h \
    public/public.h \
    sitckcontrol/stickcontrol.h \
    version.h \
    view/controlpage/autocontrol/audiocmdwidget.h \
    view/controlpage/autocontrol/globalcmdwidget.h \
    view/controlpage/autocontrol/scalelabel.h \
    view/controlpage/autocontrol/selectwnddialog.h \
    view/controlpage/autocontrol/slamwidget.h \
    view/controlpage/autocontrol/upperlimbwidget.h \
    view/controlpage/autocontrol/window.h \
    view/controlpage/setting/logmanage/logmanagement.h \
    view/controlpage/setting/mediamanage/VideoPlayerDialog.h \
    view/controlpage/setting/mediamanage/imagewidget.h \
    view/controlpage/setting/mediamanage/mediamanagement.h \
    view/controlpage/setting/mediamanage/videowidget.h \
    view/controlpage/setting/systemsetting/audiofilewidget.h \
    view/controlpage/setting/systemsetting/globalsettingwidget.h \
    view/controlpage/setting/systemsetting/hotkeyedit.h \
    view/controlpage/setting/systemsetting/otherwidget.h \
    view/controlpage/setting/systemsetting/syssettingform.h \
    view/controlpage/setting/systemsetting/uppersettingwidget.h \
    view/controlpage/setting/usermanage/userdialog.h \
    view/controlpage/setting/usermanage/usermanagement.h \
    view/controlpage/teach/teachdelegate.h \
    view/controlpage/teach/teachdialog.h \
    view/controlpage/telemetry/telemetrydialog.h \
    view/controlpage/zerodialog.h \
    view/custom/batterywidget.h \
    view/custom/dragbutton.h \
    view/custom/switchbutton.h \
    view/custom/touchbutton.h \
    view/custom/transparentbutton.h \
    view/custom/userbutton.h \
    view/custom/warninglabel.h \
    view/custom/yscheckbox.h \
    view/custom/yslabel.h \
    view/custom/yspushbutton.h \
    view/custom/yswidget.h \
    view/rtsp/rtspthread.h \
    view/rtsp/rtspwidget.h \
    view/rtsp/videodecoderthread.h \
    view/webrtc/abstractwebview.h \
    view/controlpage/autocontrol/autoform.h \
    view/controlpage/intelligence/intelligenceform.h \
    view/controlpage/maualcontrol/customslider.h \
    view/controlpage/maualcontrol/datawidget.h \
    view/controlpage/maualcontrol/jointdatadialog.h \
    view/controlpage/maualcontrol/jointsliderwidget.h \
    view/controlpage/maualcontrol/maualform.h \
    view/controlpage/maualcontrol/robotcontrolwidget.h \
    view/controlpage/remote/remoteform.h \
    view/controlpage/setting/settingform.h \
    view/controlpage/teach/teachform.h \
    view/controlpage/robotcontrolform.h \
    view/controltypeform.h \
    view/custom/ChartWidget.h \
    view/custom/MessageBox.h \
    view/custom/RangeSlider.h \
    view/custom/comboxnowheel.h \
    view/custom/custombutton.h \
    view/custom/customedit.h \
    view/custom/directioncontrolwidget.h \
    view/custom/urdfwidget.h \
    view/custom/popupdialog.h \
    view/custom/turncontroller.h \
    view/custom/usermenu.h \
    view/custom/yschartview.h \
    view/datamanager/datamanagedialog.h \
    view/datamanager/robotdialog.h \
    view/loginform.h \
    view/mainwindow.h \
    view/passworddialog.h \
    view/robotlistform.h \
    view/sitelistform.h \
    view/webrtc/webrtcwidget.h \
    view/webrtc/photodialog.h \
    view/webrtc/abstractwebview.h \
    view/controlpage/setting/mediamanage/transparentlistview.h \
    view/controlpage/setting/mediamanage/imageviewerdialog.h \
    #voiceRecognition/voiceanimation.h

FORMS += \
    view/controlpage/autocontrol/autoform.ui \
    view/controlpage/intelligence/intelligenceform.ui \
    view/controlpage/maualcontrol/maualform.ui \
    view/controlpage/remote/remoteform.ui \
    view/controlpage/setting/settingform.ui \
    view/controlpage/setting/systemsetting/syssettingform.ui \
    view/controlpage/teach/teachform.ui \
    view/controlpage/robotcontrolform.ui \
    view/controlpage/telemetry/telemetrydialog.ui \
    view/controlpage/zerodialog.ui \
    view/controltypeform.ui \
    view/datamanager/datamanagedialog.ui \
    view/datamanager/robotdialog.ui \
    view/loginform.ui \
    view/mainwindow.ui \
    view/passworddialog.ui \
    view/robotlistform.ui \
    view/sitelistform.ui \

INCLUDEPATH += $$PWD/view/
INCLUDEPATH += $$PWD/view/custom
INCLUDEPATH += $$PWD/view/controlpage
INCLUDEPATH += $$PWD/view/controlpage/maualcontrol
INCLUDEPATH += $$PWD/view/controlpage/autocontrol
INCLUDEPATH += $$PWD/view/controlpage/intelligence
INCLUDEPATH += $$PWD/view/controlpage/remote
INCLUDEPATH += $$PWD/view/controlpage/setting
INCLUDEPATH += $$PWD/view/controlpage/setting/usermanage
INCLUDEPATH += $$PWD/view/controlpage/setting/logmanage
INCLUDEPATH += $$PWD/view/controlpage/setting/mediamanage
INCLUDEPATH += $$PWD/view/controlpage/setting/systemsetting
INCLUDEPATH += $$PWD/view/controlpage/teach
INCLUDEPATH += $$PWD/view/controlpage/telemetry
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    main.qrc


# DISTFILES += \
#     android/AndroidManifest.xml

#下面配置是语音识别的
#SOURCES += voiceRecognition/voicerecognition.cpp
#HEADERS += voiceRecognition/voicerecognition.h
#INCLUDEPATH += $$PWD/voiceRecognition/
android {
    QT+=androidextras
    CONFIG += android
    ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    DISTFILES += android/src/org/qtproject/example/VoiceRecognition.java
    CONFIG += c++11
    }

win32 {
    # Python 配置
    # PYTHON_PATH = $$PWD/voiceRecognition/Python312
    # PYTHON_INCLUDE = $${PYTHON_PATH}/include

    # # 添加 Python 环境路径的宏定义
    # DEFINES += PYTHON_ENV_PATH=\\\"python_env\\\"

    # # 添加 Python 库路径和包含路径
    # INCLUDEPATH *= "$${PYTHON_INCLUDE}"
    # DEPENDPATH *= "$${PYTHON_INCLUDE}"

    # # 确保编译器能找到 Python.h
    # QMAKE_CXXFLAGS += -I"$${PYTHON_INCLUDE}"

    # # Python 库
    # LIBS += -L"$${PYTHON_PATH}/libs" -lpython312

    # # 添加编译器选项
    # QMAKE_CFLAGS += /utf-8
    # QMAKE_CXXFLAGS += /utf-8

    # # 安装 Python 包到主 Python 环境
    # QMAKE_PRE_LINK += $$quote(echo Installing Python packages...) $$escape_expand(\\n)
    # QMAKE_PRE_LINK += $$quote(\"$${PYTHON_PATH}\\python.exe\" -m pip install --upgrade pip wheel setuptools) $$escape_expand(\\n)
    # QMAKE_PRE_LINK += $$quote(\"$${PYTHON_PATH}\\python.exe\" -m pip install --no-cache-dir numpy sounddevice srt requests vosk psutil) $$escape_expand(\\n)

    # # 设置输出目录
    # CONFIG(debug, debug|release) {
    #     DESTDIR = $$OUT_PWD/debug
    # } else {
    #     DESTDIR = $$OUT_PWD/release
    # }

    # # Python 环境目录
    # PYTHON_ENV_DIR = $$DESTDIR/python_env

    # # 确保 PYTHON_SITE_PACKAGES 正确定义
    # PYTHON_SITE_PACKAGES = $${PYTHON_PATH}/Lib/site-packages

    # QMAKE_POST_LINK = $$quote(xcopy /y /s \"$$shell_path($$PWD/data)\" \"$$shell_path($$DESTDIR/data/)\") \
    #     && $$quote(if not exist \"$$shell_path($$PYTHON_ENV_DIR)\" mkdir \"$$shell_path($$PYTHON_ENV_DIR)\") \
    #     && $$quote(if not exist \"$$shell_path($$PYTHON_ENV_DIR)\\Lib\\site-packages\" mkdir \"$$shell_path($$PYTHON_ENV_DIR)\\Lib\\site-packages\") \
    #     && $$quote(echo Copying voice_commander.py to $$shell_path($$PYTHON_ENV_DIR)) \
    #     && $$quote(copy /y \"$$shell_path($$PWD/voiceRecognition/voice_commander.py)\" \"$$shell_path($$PYTHON_ENV_DIR)\") \
    #     && $$quote(copy /y \"$$shell_path($$PYTHON_PATH/python312.dll)\" \"$$shell_path($$DESTDIR)\") \
    #     && $$quote(copy /y \"$$shell_path($$PYTHON_PATH/python312.dll)\" \"$$shell_path($$PYTHON_ENV_DIR)\") \
    #     && $$quote(copy /y \"$$shell_path($$PYTHON_PATH/DLLs)\\*\" \"$$shell_path($$PYTHON_ENV_DIR)\") \
    #     && $$quote(xcopy /y /s /i \"$$shell_path($$PYTHON_PATH/Lib)\" \"$$shell_path($$PYTHON_ENV_DIR)\\Lib\") \
    #     && $$quote(xcopy /y /s /i \"$$shell_path($${PYTHON_SITE_PACKAGES})\" \"$$shell_path($$PYTHON_ENV_DIR)\\Lib\\site-packages\")

    # # 如果存在 vosk 模型，则复制
    # exists($$PWD/voiceRecognition/vosk-model-small-cn-0.22) {
    #     QMAKE_POST_LINK += \
    #         && $$quote(echo Copying vosk model...) \
    #         && $$quote(xcopy /y /s /i \"$$shell_path($$PWD/voiceRecognition/vosk-model-small-cn-0.22)\" \"$$shell_path($$PYTHON_ENV_DIR)\\vosk-model-small-cn-0.22\") \
    #         && $$quote(xcopy /y /s /i \"$$shell_path($$PWD/voiceRecognition/vosk-model-small-cn-0.22)\" \"$$shell_path($$DESTDIR)\\vosk-model-small-cn-0.22\")
    # }

    # # 添加 Windows API 定义
     DEFINES += WIN32_LEAN_AND_MEAN
    # # 调试信息
    # message(Python path: $${PYTHON_PATH})
    # message(Python include path: $${PYTHON_INCLUDE})
    # message(Include path: $${INCLUDEPATH})
    # message(Library path: $${LIBS})
    # 保持控制台输出
    # 保持控制台输出
#    CONFIG += console
}

DISTFILES +=
# -------- Git 自动自增版本号配置 --------
# 在源码目录执行 git，避免 Qt Creator 在 build 目录下执行失败
GIT_DIR = $$PWD

# 提交次数
git_describe.commands = cd $$GIT_DIR && git rev-list --count HEAD
git_describe.output = $$system($$git_describe.commands)

# 最终版本号：例如 1.0.135
VERSION = 1.0.$${git_describe.output}

# 定义为宏，可在 C++ / QML 使用
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

message(Build Version: $$VERSION)
# ----------------------------------------
















